package com.syh.jn.scm.service.impl.downstream.base;

import cn.redscarf.commons.util.other.ExtAssert;
import com.alibaba.dubbo.config.annotation.Service;
import com.syh.core.ddd.infrastructure.repository.AggregateRepository;
import com.syh.core.ddd.service.AbstractServiceImpl;
import com.syh.jn.scm.domain.downstream.entity.base.DownGoods;
import com.syh.jn.scm.domain.downstream.repository.base.DownGoodsRepository;
import com.syh.jn.scm.dto.downstream.base.*;
import com.syh.jn.scm.service.api.downstream.base.DownGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

/**
 * 商品信息管理
 */
@Service
@Transactional
public class DownGoodsServiceImpl extends AbstractServiceImpl<Object, Object, DownGoodsVo, DownGoods, Long> implements DownGoodsService {
  @Autowired
  private DownGoodsRepository downGoodsRepository;

  @Override
  protected AggregateRepository<DownGoods, Long> getAggregateRepository() {
    return downGoodsRepository;
  }

  @Override
  public Long save(Object o) {
    return null;
  }

  @Override
  public void update(Object o) {

  }

  @Override
  public void delete(Long id) {

  }

  /**
   * 根据id查找商品信息
   * @param id
   * @return
   */
  private DownGoods getDownGoodsById(Long id){
    ExtAssert.notNull(id, "id为空");
    DownGoods downGoods = downGoodsRepository.getById(id);

    ExtAssert.notNull(downGoods, "对象为空");

    return downGoods;
  }
}
